Skip to content

BUILD-12715 Install config action tools through mise-action-wrapper with its cache disabled - #395

Closed
SamirM-BE wants to merge 2 commits into
masterfrom
feat/smarini/BUILD-12715-miseCacheSingleOwner
Closed

SamirM-BE wants to merge 2 commits into
masterfrom
feat/smarini/BUILD-12715-miseCacheSingleOwner

Conversation

@SamirM-BE

@SamirM-BE SamirM-BE commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What

config-poetry, config-uv and config-npm install their helper tools (jfrog-cli, plus jq for npm) through SonarSource/mise-action-wrapper 2.2.0 with cache: false, instead of calling step-security/mise-action directly. spec/mise-cache-owner_spec.sh now asserts that each action's mise step is the SHA-pinned wrapper with cache: false and that no direct step-security/mise-action step remains. The version: 2026.10.17 pin is removed from the three actions: the wrapper pins mise itself.

Why

When a job installs the caller's tools first (wrapper, cache restored into the mise data directory) and then calls config-*, the old direct step restored its default mise-v1-... cache over the same directory. The older tarball overwrote files with the same name and kept the others (mixed Poetry/filelock files in one run), and replaced the pinned mise binary with the older one.

One cache must own the mise data directory. The wrapper's cache also stores the whole data directory, so a second wrapper cache entry in config-* would recreate the problem: the call uses cache: false. With cache: false the wrapper still configures Vault and Repox, and installs with a pinned mise, so there is a single mise version pin (bumped by Renovate in the wrapper) and no binary swap.

Design choices and rejected alternatives

  • Wrapper with cache: false rather than cache: false on the direct step (previous version of this PR): that fixes the double restore but keeps a second, separately pinned mise version that swaps the binary after the caller's step.
  • Not a different cache_key_prefix on the wrapper: still extracts a second tarball over a live install.
  • Not pinning filelock: hides one package only.
  • Keeping step-security/mise-action directly: rejected for the above.
  • Pinned by full SHA with a # 2.2.0 comment, as other actions in this repo.
  • The existing Vault step and credentials in config-* stay: they support Edge URLs and the dev Vault, which the wrapper does not.
  • Not removing any input of config-*: none became redundant.

Impact on other workloads

  • Callers of config-*: mise is now 2026.11.7 (wrapper pin) instead of 2026.10.17 after the step. jfrog-cli 2.115.0 and jq 1.8.1 install fine on it (validation below).
  • The wrapper also does Vault and Repox setup once per call: one extra Vault read of the reader token, and it exports Repox settings for later steps of the job (PIP_INDEX_URL, UV_DEFAULT_INDEX, MISE_PIPX_REGISTRY_URL, MISE_BACKENDS_POETRY, MISE_URL_REPLACEMENTS) and appends to ~/.netrc and ~/.npmrc. Callers that already use the wrapper get the same values; callers that did not now get mise backends resolved through Repox in later mise steps.
  • Not isolated: the wrapper's Vault path and Repox URL are fixed to Repox SaaS (https://repox.jfrog.io); config-* on Edge (repox-url set to an Edge URL, self-hosted runners) still fetches its own Edge credentials afterwards, but the mise step itself now needs Vault and SaaS Repox access from that runner. Not exercised in validation.
  • The build-* actions still run their own mise step with its cache; that step runs before config-* and no second cache lands on top of it.

Cost

No new infrastructure. A few seconds per call (cache restore replaced by a small install). No measurable monthly change.

Rollback

Revert the commits of this PR; behavior returns to the direct step with the cache.

Follow-ups

  • build-poetry, build-npm, build-yarn, promote, update-release-channel: move to the wrapper (single owner), not changed here.
  • Drop the Vault duplication in config-* if the wrapper gains Edge support.
  • The v1 branch is not maintained (backport PR closed).

Validation

Throwaway workflow in SonarSource/sonar-scanner-python: cold wrapper key per run (unique cache_key_prefix), caller wrapper old (mise 2026.10.2) or 2.2.0, then config-poetry from master (control) or this branch. Run: https://github.com/SonarSource/sonar-scanner-python/actions/runs/47363606530

  • control master: Cache hit for: mise-v1-linux-x64-ubuntu24-2026.10.17-..., mise cache restored from key: mise-v1-...; mise --version after config-poetry: 2026.10.17 (caller's 2026.10.2 or 2026.11.7 replaced). Configure poetry and poetry version -s pass: the current mise-v1 entry is no longer stale, so the master line alone does not reproduce the broken tree.
  • this branch: no mise-v1 restore; Configure poetry succeeds; poetry --version prints 2.2.1 and poetry version -s succeeds; mise --version after config-poetry: 2026.11.7 (the wrapper pin).
  • Only the earlier v1 line, now unmaintained, reproduced the failure (run 47352342672).
  • shellspec spec/mise-cache-owner_spec.sh fails on master actions and passes here; pre-commit run --all-files passes.

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

BUILD-12715

@SamirM-BE
SamirM-BE marked this pull request as draft December 4, 2026 15:22
@SamirM-BE SamirM-BE changed the title BUILD-12715 Let only one cache own the mise data directory in config actions BUILD-12715 Install config action tools through mise-action-wrapper with its cache disabled Dec 4, 2026
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

Comment thread config-npm/action.yml
Comment on lines +88 to +91
- uses: SonarSource/mise-action-wrapper@058f4c006a2dd0dc3152f37d019bae6c65093b59 # 2.2.0
if: steps.config-npm-completed.outputs.skip != 'true'
with:
version: 2026.10.17
cache: false

@gitar-bot gitar-bot Bot Dec 4, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: Wrapper overwrites custom ARTIFACTORY_READER_ROLE before the Vault step

The setup step works out ARTIFACTORY_READER_ROLE from the artifactory-reader-role input and writes it to GITHUB_ENV (config-npm line 82; config-poetry line 89 and config-uv line 90 do the same). The new SonarSource/mise-action-wrapper step comes next, and it receives only cache: false. The wrapper's action.yaml at 2.2.0 has a 'Set Artifactory reader role' step. That step reads only its own artifactory_reader_role input, which is empty here. It falls back to public-reader or private-reader based on repository visibility and writes that value to GITHUB_ENV. This replaces the caller's role.

The action's own vault-action-wrapper step runs after that and builds its secret path from env.ARTIFACTORY_READER_ROLE. So when a caller sets a custom artifactory-reader-role, the role is now silently ignored. The npm, poetry or uv credentials are fetched for the default role, and the Vault lookup or later Artifactory access can fail. The overwritten value also stays in the job env after the config action finishes. Before this PR, step-security/mise-action did not touch this variable.

Related: the wrapper also runs with its defaults repox_url=https://repox.jfrog.io and vault_url=https://vault.sonar.build, so the action's repox-url selection (Edge on self-hosted runners, the dev Vault for .dev.sonar.build) is not applied to the wrapper's own Vault/Repox calls.

Pass the resolved role (and the Repox/Vault endpoints) to the wrapper so it writes back the same value (same change in config-poetry and config-uv).:

- uses: SonarSource/mise-action-wrapper@058f4c006a2dd0dc3152f37d019bae6c65093b59 # 2.2.0
  if: steps.config-npm-completed.outputs.skip != 'true'
  with:
    cache: false
    artifactory_reader_role: ${{ env.ARTIFACTORY_READER_ROLE }}
    repox_url: ${{ inputs.repox-url }}
    vault_url: ${{ contains(inputs.repox-url, '.dev.sonar.build') && 'https://vault.dev.sonar.build' || 'https://vault.sonar.build' }}

Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 🟡 Medium risk 0 closed / 1 findings

Switching config actions to the mise wrapper with caching disabled changes tool setup and may trigger fresh helper-tool installs on each run.

Switches config-poetry, config-uv and config-npm to SonarSource/mise-action-wrapper with its cache disabled, so only one cache owns the mise data directory. Changes requested: the wrapper's Artifactory reader role step overwrites a caller's custom artifactory-reader-role before the Vault step reads it, silently ignoring that input and leaving the overwritten value in the job env. The wrapper also runs with default repox_url and vault_url, so the action's repox-url selection is not applied to its Vault and Repox calls.

⚠️ Bug: Wrapper overwrites custom ARTIFACTORY_READER_ROLE before the Vault step

📄 config-npm/action.yml:51-52 📄 config-npm/action.yml:82 📄 config-npm/action.yml:88-91 📄 config-npm/action.yml:93-101 📄 config-poetry/action.yml:113-117 📄 config-uv/action.yml:101-105

The setup step works out ARTIFACTORY_READER_ROLE from the artifactory-reader-role input and writes it to GITHUB_ENV (config-npm line 82; config-poetry line 89 and config-uv line 90 do the same). The new SonarSource/mise-action-wrapper step comes next, and it receives only cache: false. The wrapper's action.yaml at 2.2.0 has a 'Set Artifactory reader role' step. That step reads only its own artifactory_reader_role input, which is empty here. It falls back to public-reader or private-reader based on repository visibility and writes that value to GITHUB_ENV. This replaces the caller's role.

The action's own vault-action-wrapper step runs after that and builds its secret path from env.ARTIFACTORY_READER_ROLE. So when a caller sets a custom artifactory-reader-role, the role is now silently ignored. The npm, poetry or uv credentials are fetched for the default role, and the Vault lookup or later Artifactory access can fail. The overwritten value also stays in the job env after the config action finishes. Before this PR, step-security/mise-action did not touch this variable.

Related: the wrapper also runs with its defaults repox_url=https://repox.jfrog.io and vault_url=https://vault.sonar.build, so the action's repox-url selection (Edge on self-hosted runners, the dev Vault for .dev.sonar.build) is not applied to the wrapper's own Vault/Repox calls.

Pass the resolved role (and the Repox/Vault endpoints) to the wrapper so it writes back the same value (same change in config-poetry and config-uv).
- uses: SonarSource/mise-action-wrapper@058f4c006a2dd0dc3152f37d019bae6c65093b59 # 2.2.0
  if: steps.config-npm-completed.outputs.skip != 'true'
  with:
    cache: false
    artifactory_reader_role: ${{ env.ARTIFACTORY_READER_ROLE }}
    repox_url: ${{ inputs.repox-url }}
    vault_url: ${{ contains(inputs.repox-url, '.dev.sonar.build') && 'https://vault.dev.sonar.build' || 'https://vault.sonar.build' }}
🤖 Prompt for agents
Code Review: Switches config-poetry, config-uv and config-npm to SonarSource/mise-action-wrapper with its cache disabled, so only one cache owns the mise data directory. Changes requested: the wrapper's Artifactory reader role step overwrites a caller's custom `artifactory-reader-role` before the Vault step reads it, silently ignoring that input and leaving the overwritten value in the job env. The wrapper also runs with default `repox_url` and `vault_url`, so the action's `repox-url` selection is not applied to its Vault and Repox calls.

1. ⚠️ Bug: Wrapper overwrites custom ARTIFACTORY_READER_ROLE before the Vault step
   Files: config-npm/action.yml:51-52, config-npm/action.yml:82, config-npm/action.yml:88-91, config-npm/action.yml:93-101, config-poetry/action.yml:113-117, config-uv/action.yml:101-105

   The setup step works out `ARTIFACTORY_READER_ROLE` from the `artifactory-reader-role` input and writes it to `GITHUB_ENV` (config-npm line 82; config-poetry line 89 and config-uv line 90 do the same). The new `SonarSource/mise-action-wrapper` step comes next, and it receives only `cache: false`. The [wrapper's action.yaml at 2.2.0](https://raw.githubusercontent.com/SonarSource/mise-action-wrapper/058f4c006a2dd0dc3152f37d019bae6c65093b59/action.yaml) has a 'Set Artifactory reader role' step. That step reads only its own `artifactory_reader_role` input, which is empty here. It falls back to `public-reader` or `private-reader` based on repository visibility and writes that value to `GITHUB_ENV`. This replaces the caller's role.
   
   The action's own `vault-action-wrapper` step runs after that and builds its secret path from `env.ARTIFACTORY_READER_ROLE`. So when a caller sets a custom `artifactory-reader-role`, the role is now silently ignored. The npm, poetry or uv credentials are fetched for the default role, and the Vault lookup or later Artifactory access can fail. The overwritten value also stays in the job env after the config action finishes. Before this PR, `step-security/mise-action` did not touch this variable.
   
   Related: the wrapper also runs with its defaults `repox_url=https://repox.jfrog.io` and `vault_url=https://vault.sonar.build`, so the action's `repox-url` selection (Edge on self-hosted runners, the dev Vault for `.dev.sonar.build`) is not applied to the wrapper's own Vault/Repox calls.

   Fix (Pass the resolved role (and the Repox/Vault endpoints) to the wrapper so it writes back the same value (same change in config-poetry and config-uv).):
   - uses: SonarSource/mise-action-wrapper@058f4c006a2dd0dc3152f37d019bae6c65093b59 # 2.2.0
     if: steps.config-npm-completed.outputs.skip != 'true'
     with:
       cache: false
       artifactory_reader_role: ${{ env.ARTIFACTORY_READER_ROLE }}
       repox_url: ${{ inputs.repox-url }}
       vault_url: ${{ contains(inputs.repox-url, '.dev.sonar.build') && 'https://vault.dev.sonar.build' || 'https://vault.sonar.build' }}

Verification Rules 1/1 met PRs 3 inspected

Functional validation No results

Rules 1 passed 5 not applicable

✅ StepSecurity maintained GitHub Actions

Broader impact PRs 3 inspected
Cross-PR 3 PRs inspected 0 open impacts

PR 379: Update GitHub actions Inspected
PR 378: Update dependency mise to 2026.11.14 Inspected
PR 10: Update dependency mise to 2026.11.14 Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.
Unblock → Override a blocking verdict and allow merging.

Comment with these commands to change the behavior for this request:

Auto-apply Compact Unblock
gitar auto-apply:on         
gitar display:verbose         
gitar unblock         

Was this helpful? React with 👍 / 👎 | Gitar

@SamirM-BE

Copy link
Copy Markdown
Contributor Author

Closing: the failure only reproduced on the unmaintained v1 line. Validation on v2 with mise-action-wrapper 2.2.0 passed cold and warm (both caches restored), so this cleanup is not needed. Repositories still on v1 should move to v2.

@SamirM-BE SamirM-BE closed this Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant